Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(protocol-designer): refactor well order modal to remove single edit dependencies #7375

Merged
merged 2 commits into from
Feb 23, 2021

Conversation

shlokamin
Copy link
Member

Overview

Closes #7228

Changelog

  • Refactor well order modal to remove single edit dependencies

Review requests

  • Code review
  • Well order field in transfer form should work the same as on prod
  • Well order field in mix form should work the same as on prod

Risk assessment

Low

…le edit dependencies

refactor well order modal to remove single edit dependencies
@shlokamin shlokamin requested review from Kadee80, IanLondon and a team February 23, 2021 17:32
Comment on lines +18 to +19
updateFirstWellOrder: $PropertyType<FieldProps, 'updateValue'>,
updateSecondWellOrder: $PropertyType<FieldProps, 'updateValue'>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to do this because this component needs two updaters (first well order and second).

Comment on lines -59 to +41
class WellOrderModalComponent extends React.Component<Props, State> {
export class WellOrderModal extends React.Component<Props, State> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about refactoring this to be a function component and use hooks but got lazy. I'm down to do that though if we think it's important

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah we have enough to do for this project 😛

Copy link
Contributor

@Kadee80 Kadee80 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


transfer and mix well orders behave the same as in prod. was able to import to prod to confirm.

Copy link
Contributor

@IanLondon IanLondon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functionality preserved in transfer and mix, code looks good. Annoying how in this one place, multiple fields get updated together, I just played around with the form and I didn't find any other where we're updating 2 keys together.

In theory, we will now enter a weird condition where updating the first well order field before the second gives us a nonsense well order, eg "l2r, l2r". But that's only in unsavedForm, so we should be safe. If it gives us problems we can think about special machinery for fields that need to update multiple values, but since this is the only one like that it seems a little extra RN

isOpen: boolean,
closeModal: () => mixed,
prefix: 'aspirate' | 'dispense' | 'mix',
formData: FormData,
updateValues: (firstValue: ?WellOrderOption, ?WellOrderOption) => void,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be like firstValue: ?WellOrderOption, secondValue: ?WellOrderOption? I didn't know syntax would allow you to do just one named arg. Just a readability thing though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol i didn't even realize i did that — good catch will fix this real quick

Comment on lines -59 to +41
class WellOrderModalComponent extends React.Component<Props, State> {
export class WellOrderModal extends React.Component<Props, State> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah we have enough to do for this project 😛

@shlokamin shlokamin merged commit 59ab7e6 into edge Feb 23, 2021
@shlokamin shlokamin deleted the pd_refactor-well-order-field branch February 23, 2021 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prepare well order modal for batch edit form
3 participants